package com.yxhl.zoume.utils;

import android.app.Activity;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by vhawk on 16/5/3.
 * 判断App是否退出
 */
public class ActivityControlUtils {

    private static final String TAG = "ActivityControlUtils";

    private static Map<Class<? extends Activity>, Activity> activityMap = new HashMap<>();


    public static void put(Activity activity) {
        activityMap.put(activity.getClass(), activity);
    }

    public static void remove(Activity activity) {
        activityMap.remove(activity.getClass());
    }

    public static boolean contains(Class<? extends Activity> clazz) {
        if (!activityMap.containsKey(clazz)) {
            return false;
        } else {
            Activity activity = activityMap.get(clazz);
            if (activity == null) {
                return false;
            }
        }
        return true;
    }

    public static int getActivityCount() {
        return activityMap.size();
    }

}
